var stompClient = null;
	function setConnected(connected){
		document.getElementById('connect').disabled = connected;
		document.getElementById('disconnect').disabled = !connected;
		document.getElementById('conversationDiv').style.visibility = connected ?'visible':'hideen';
		$("#response").html();
	}
	function connect(){
		var socket = new SockJS("/xupx");
		stompClient = Stomp.over(socket);
		stompClient.connect({},function(frame){
			setConnected(true);
			console.log("connected: " + frame);
			stompClient.subscribe("/topic/getReponse",function(reponse){
				var a = JSON.parse(reponse.body).responseMessage;
				showResponse(a);
			});
		});
	}
	function disconnect(){
		if(stompClient != null){
			stompClient.disconnect();
		}
		setConnected(false);
		console.log("disconnect");
	}
	function sendName(){
		var name = $("#name").val();
		stompClient.send("/welcome",{},JSON.stringify({'name':name}));
	}
	function showResponse(message){
		debugger;
		var reponse = $("#response");
		reponse.html(message);
	}